package com.finace.money.presenter;

import com.finace.money.data.bean.EmptyBean;
import com.finace.money.net.rto_rxbuild.RxHttpReponseCompat;
import com.finace.money.net.rto_subscriber.ProgressSubcriber;
import com.finace.money.presenter.contract.UploadImageContract;

import java.io.File;

import javax.inject.Inject;

/**
 * Created by zhangpeng on 2018/2/1.
 */

public class UploadImagePresenter extends BasePresenter<UploadImageContract.IUploadImageModel,UploadImageContract.View>{

    @Inject
    public UploadImagePresenter(UploadImageContract.IUploadImageModel iUploadImageModel, UploadImageContract.View view) {
        super(iUploadImageModel, view);
    }

    public void register(String phone, String imgcode, String code, String name,
                         String email, String cardno, String province, String city,
                         String county, String specific_address, File face_card, File identity_card) {
        mModel.register(phone, imgcode, code,
                name, email, cardno,
                province, city,
                county, specific_address, face_card,
                identity_card).compose(RxHttpReponseCompat.<EmptyBean>compatResult())
                .subscribe(new ProgressSubcriber<EmptyBean>(mContext, mView) {
                    @Override
                    public void onNext(EmptyBean emptyBean) {
                        if(hasView()){
                            mView.commitSucess();
                        }
                    }
                });
    }
}
